package cn.tedu.ge_two;

public class Test22 {
public static void main(String[] args) {
	Student2 s=new Student2("л",20);
	Student2 s2=new Student2("л",20);
	System.out.println(s);
	System.out.println(s.equals(s2));
}
}
class Student2{
	public Student2() {}
	public Student2(String name, int a) {
		super();
		this.name = name;
		this.a = a;
	}
	private String name;
	private int a;
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public int getA() {
		return a;
	}
	public void setA(int a) {
		this.a = a;
	}
	@Override
	public String toString() {
		return "Student2 [name=" + name + ", a=" + a + "]";
	}

	
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Student2 other = (Student2) obj;
		if (a != other.a)
			return false;
		if (name == null) {
			if (other.name != null)
				return false;
		} else if (!name.equals(other.name))
			return false;
		return true;
	}
}